#define _CRT_SECURE_NO_WARNINGS

#include "header.h"

int main()
{

#if DEBUG_TEST_FILE_PART
	FILE* pf = fopen("data.dat", "ab");
	time_t now;
	time(&now);
	score_list sl;
	strcpy(sl.date, asctime(localtime(&now)));
	int date_len = strlen(sl.date);
	sl.date[date_len - 1] = '\0';
	strcpy(sl.name, "dL");
	sl.score = 1000;
	sl.steps = 100;

	clock_start = time(NULL);
	Sleep(3000);
	clock_end = time(NULL);
	time_t seconds_spent = clock_end - clock_start;
	int m = 0, s = 0;
	m = seconds_spent / 60;
	s = seconds_spent - m * 60;
	sprintf(sl.time, "%3d:%02d", m, s);

	fwrite(&sl, sizeof(score_list), 1, pf);
	fclose(pf);
#endif

	srand((unsigned int)time(NULL));
	int choose = 0;
	while (1)
	{
		Menu();
		printf("\033[38;2;%d;%d;%dm\033[5m", 255, 128, 0);
		printf("\n               ");
		scanf("%d", &choose);
		printf("\n");
		printf("\033[0m");
		Clear();
		switch (choose)
		{
		case 1:
		{
			Game();
			break;
		}
		case 2:
		{
			ShowRank();
			break;
		}
		case 0:
		{
			return 0;
			break;
		}
		default:
		{
			printf("\033[31mTyping error.\033[0m\n");
			break;
		}
		}
	}

	return 0;
}